package com.cx.service.serviceimp;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;

import com.cx.mapper.PushedDataMapper;

import java.util.List;

import com.cx.entity.PushedData;
import com.cx.service.PushedDataService;

@Service
public class PushedDataServiceImpl implements PushedDataService {

    @Resource
    private PushedDataMapper pushedDataMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return pushedDataMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(PushedData record) {
        return pushedDataMapper.insert(record);
    }

    @Override
    public int insertOrUpdate(PushedData record) {
        return pushedDataMapper.insertOrUpdate(record);
    }

    @Override
    public int insertOrUpdateSelective(PushedData record) {
        return pushedDataMapper.insertOrUpdateSelective(record);
    }

    @Override
    public int insertSelective(PushedData record) {
        return pushedDataMapper.insertSelective(record);
    }

    @Override
    public PushedData selectByPrimaryKey(Long id) {
        return pushedDataMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(PushedData record) {
        return pushedDataMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(PushedData record) {
        return pushedDataMapper.updateByPrimaryKey(record);
    }

    @Override
    public int updateBatch(List<PushedData> list) {
        return pushedDataMapper.updateBatch(list);
    }

    @Override
    public int batchInsert(List<PushedData> list) {
        return pushedDataMapper.batchInsert(list);
    }

    @Override
    public List<PushedData> getAll() {
        return pushedDataMapper.getAll();
    }

    @Override
    public List<PushedData> getPart(PushedData record) {
//        计算页数
        record.setOffSet(record.getCurrentPage() - 1);
        //数据总条数
        int i = selectCount();
        List<PushedData> part = pushedDataMapper.getPart(record);
        if (part.size() > 0) {
            part.get(0).setTotal(i);
        }
        return part;
    }

    @Override
    public int selectCount() {
        return pushedDataMapper.selectCount();
    }


}




